﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using Models;

namespace BLL
{
    public class PJNodeManager
    {
        private PJNodeService objPJNodeService = new PJNodeService();
        #region 新增更改
        /// <summary>
        /// 添加或修改数据到项目主表
        /// </summary>
        /// <param name="PJMain"></param>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public string InsertInfo(PJNode PJNode, string tableName)
        {

            objPJNodeService.InsertInfo(PJNode, tableName);
            return PJNode.PJId;
        }
        /// <summary>
        /// 根据工作流号更改项目主表数据
        /// </summary>
        /// <param name="PJMains"></param>
        /// <returns></returns>
        public int UpdateInfo(PJNode PJNode, string tableName, string pjId)
        {
            return objPJNodeService.UpdateInfo(PJNode, tableName, pjId);
        }
        /// <summary>
        /// 根据项目号更改项目主表状态
        /// </summary>
        /// <param name="pjId"></param>
        /// <param name="afterStatues"></param>
        /// <returns></returns>
        public int UpdateInfo(int workParentId, string afterStatues, string tableName)
        {
            return objPJNodeService.UpdateInfo(workParentId, afterStatues, tableName);
        }
        #endregion

        #region 查询
        /// <summary>
        /// 查询是否已新建过PJid
        /// </summary>
        /// <param name="pjId"></param>
        /// <returns></returns>
        public int GetIsNoPJId(string pjId,string tableName)
        {
            return objPJNodeService.GetIsNoPJId(pjId, tableName);
        }

        /// <summary>
        /// 根据workParentId或pjid查询信息
        /// </summary>
        /// <param name="workParentId"></param>
        /// <param name="pjId"></param>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public List<PJNode> GetPJNodeInfo(int workParentId, string pjId, string tableName)
        {
            return objPJNodeService.GetPJNodeInfo(workParentId, pjId, tableName);
            
        }
        /// <summary>
        /// 获取模板信息
        /// </summary>
        /// <returns></returns>
        public List<PJNode> GetPJNodeMould()
        {
            return objPJNodeService.GetPJNodeMould();
        }
        #endregion

        #region 删除
        /// <summary>
        /// 删除节点数据
        /// </summary>
        /// <param name="pjId"></param>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public int DeletePJNode(int workparentId,string pjId, string tableName)
        {
            return objPJNodeService.DeletePJNode(workparentId,pjId, tableName);
        }
        #endregion
    }
}
